<?php
class App_Model_Auth
{
   private static $done = false;
   private static $admin;
	
   public static function isAdmin($roles = null){
      if(self::$done == false){
         self::$done = true;
         $role = new App_Model_Role();
         self::$admin = $role->isAdmin($roles);
      }	
      return self::$admin;
   }
   public static function generatePass(){
      $duze = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
      $male = array('a','b','c','d','e','f','g','h','i','j','k','l','m','m','o','p','q','r','s','t','u','v','w','x','y','z');
      $cyfry = array(0,1,2,3,4,5,6,7,8,9);
         
      $pass = array();
         
      for($i = 0 ; $i < 4; $i++)
         $pass[] = $duze[mt_rand(0, count($duze)-1)];

      for($i = 0 ; $i < 4; $i++)
         $pass[] = $male[mt_rand(0, count($male)-1)];
            
      for($i = 0 ; $i < 4; $i++)
         $pass[] = $cyfry[mt_rand(0, count($cyfry)-1)];
            
      shuffle($pass);
      return implode('', $pass);
   }
}
